<?
 require_once("../inc/functions.php");
 require_once("./address.php");

 
 $results = getAddressInfo($_GET['addressid']);
 
 $row = $results->fetch_assoc();

?>
<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title><?=$title ?> Edit Address</title>
         <? require('../inc/header-info.php'); ?>
    </head>
    <body>
        <div class="container">
            <? include('../inc/nav.php'); ?>
             <form name="Edit_Address" method="post" action="address-edit.php">
             	<h4>New Address for Customer: <?=$_GET['id']?></h4>
             	<input type="hidden" name="UpdateAddress" value='1'>
             	<input type="hidden" name="Customer_Name_id1" value='<?=$_GET['id']?>'>
             	<input type="hidden" name="id" value='<?=$row['id']?>'>    
            	
            		<label class="control-label" for="Contact_type">Address Type:</label>
            		<select name='Contact_type_id' class="span2">
            			
            			<option value='<?=$row['Contact_type_id']?>'><?=$row['Contact_type']?></option>
  						<option value='23'>Billing Address</option>
  						<option value='18'>Home Address</option>
  						<option value='22'>Shipping Address</option>
  						<option value='21'>Work Address</option>
					</select>
            	
					<label class="control-label" for="address0">Address:</label>
					<div class="controls">
						<input type="text" id="address0"  name="address0" placeholder="Address" <? if($row['address0']){ echo "value='$row[address0]'";} ?>>
					</div>
					<div class="controls">	
						<input type="text" id="address1" name="address1" placeholder="Address" <? if($row['address1']){ echo "value='$row[address1]'";} ?>>
					</div>
					
					<label class="control-label" for="city">City:</label>
					<div class="controls">
						<input type="text" id="city" name="city" placeholder="City" <? if($row['city']){ echo "value='$row[city]'";} ?>>
					</div>
					
					<label class="control-label" for="state">State:</label>
					<div class="controls">
						<input type="text" id="state" name="state" placeholder="State" <? if($row['state']){ echo "value='$row[state]'";} ?>>
					</div>
					
					<label class="control-label" for="country">Country:</label>
					<div class="controls">
						<input type="text" id="country" name="country" placeholder="Country" <? if($row['country']){ echo "value='$row[country]'";} ?>>
					</div>
					
					<label class="control-label" for="postal_code">Postal Code:</label>
					<div class="controls">
						<input type="text" id="postal_code" name="postal_code" placeholder="Postal Code" <? if($row['postal_code']){ echo "value='$row[postal_code]'";} ?>>
					</div>
    			
            	<div class="form-actions">
  					<button type="submit" class="btn btn-primary">Edit Address</button>
					<button type="button" class="btn">Cancel</button>
				</div>	
            </form> 
		</div>
	</body>
</html>